//
//  JQFYMusicPlayer.h
//  JQFY
//
//  Created by 代辉 on 2017/8/18.
//  Copyright © 2017年 yannis. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ZWSingleton.h"
#import "JQFYSong.h"
#import "JQFYHomeRecommendMusic.h"

/**
 音乐播放器管理者
 */
@interface JQFYMusicPlayer : NSObject

// 播放器状态枚举
typedef NS_ENUM(NSUInteger, JQFYMusicPlayerStatus) {
    JQFYMusicPlayerStatusPlaying, // 正在播放
    JQFYMusicPlayerStatusPaused   // 当前暂停状态
};

typedef NS_ENUM(NSUInteger, JQFYMusicChartCellAnimationStatus) {
    JQFYMusicChartCellAnimationing,
    JQFYMusicChartCellAnimationPause,
    JQFYMusicChartCellAnimationed,
    JQFYMusicChartCellAnimationResume
};


// 歌曲播放状态发生变化通知
#define kMusicPlayerStatus                          @"kMusicPlayerStatus"
#define JQFYMusicPlayerStatusDidChangedNotification   @"JQFYMusicPlayerStatusDidChangedNotification"

// 正在播放的歌曲发生变化通知
#define kMusicPlayerPlayingSong                         @"kMusicPlayerPlayingSong"
#define JQFYMusicPlayerPlayingSongDidChangedNotification  @"JQFYMusicPlayerPlayingSongDidChangedNotification"

// 当前播放歌曲的进度发生变化时回调
#define kCurrentTime                                    @"kCurrentTime"
#define kTotalTime                                      @"kTotalTime"
#define JQFYMusicPlayerCurrentTimeDidChangedNotification  @"JQFYMusicPlayerCurrentTimeDidChangedNotification"



// 定义快捷访问宏
#define __Player__ ([JQFYMusicPlayer sharedInstance])

#define NUMBERINDEX   @"NUMBERINDEX"
INTERFACE_SINGLETON(JQFYMusicPlayer)

#pragma mark - 属性 -
@property (strong, nonatomic) JQFYSong    *playingSong;             // 正在播放的歌曲
@property (strong, nonatomic) NSArray <JQFYSong *> *songs;           // 当前循环播放的歌曲列表
@property (assign, nonatomic)   JQFYMusicPlayerStatus status;       // 播放器当前的播放状态
@property (assign, nonatomic)   float       currentTime;            // 当前播放时间
@property (readonly, nonatomic) float       totalTime;              // 当前播放歌曲的总时间
@property (nonatomic,assign) BOOL isPlaying;                        // 是否正在播放
@property (nonatomic,assign) NSInteger numIndex;                    // 设置循环模式
@property (nonatomic,weak) UIButton *currentBtn;                    // 第二组cell正在播放的Btn
@property (nonatomic,strong) UIView *currentEffView;
@property (nonatomic,strong) JQFYSong *currentModel;
@property (nonatomic,strong) NSArray <JQFYSong *>*recommendMusics;
@property (nonatomic,strong) NSIndexPath *playIndexPath;;
// 通过歌曲索引播放歌曲
- (void)playAtIndex:(NSInteger)index;

/// 上一曲
- (void)prev;

/// 下一曲
- (void)next;

/// 播放
- (void)play;

/// 暂停
- (void)pause;

// 开始监视歌曲播放时间
- (void)startObserveCurrentTime;

// 结束监视歌曲播放时间
- (void)stopObserveCurrentTime;

//判断歌曲是否正在网络加载
- (void)isNetWorkPlaying;

// 设置音量
- (void)setVolume:(CGFloat)volume;

@end
